home *** CD-ROM | disk | FTP | other *** search
-
-
-
- VVVVAAAARRRRAAAARRRRGGGGSSSS((((3333FFFF)))) VVVVAAAARRRRAAAARRRRGGGGSSSS((((3333FFFF))))
-
-
-
- NNNNAAAAMMMMEEEE
- varargs, argmnt, getadr, nullok, xetarg, retour - allow variable number
- of arguments in argument list
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee aaaarrrrggggmmmmnnnntttt(((( nnnnaaaarrrrggggssss ))))
- iiiinnnntttteeeeggggeeeerrrr****4444 nnnnaaaarrrrggggssss
-
- ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee ggggeeeettttaaaaddddrrrr(((( nnnn,,,, iiiiaaaaddddddddrrrr ))))
- iiiinnnntttteeeeggggeeeerrrr****4444 nnnn,,,, iiiiaaaaddddddddrrrr
-
- iiiinnnntttteeeeggggeeeerrrr****4444 ffffuuuunnnnccccttttiiiioooonnnn nnnnuuuullllllllooookkkk(((( nnnn,,,, iiiiaaaaddddddddrrrr ))))
- iiiinnnntttteeeeggggeeeerrrr****4444 nnnn,,,, iiiiaaaaddddddddrrrr
-
- ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee xxxxeeeettttaaaarrrrgggg(((( nnnn,,,, lllleeeennnn,,,, iiiiaaaarrrrgggg ))))
- iiiinnnntttteeeeggggeeeerrrr****4444 nnnn,,,, lllleeeennnn
- aaaannnnyyyyttttyyyyppppeeee iiiiaaaarrrrgggg
-
- ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee rrrreeeettttoooouuuurrrr(((( nnnnaaaarrrrggggssss,,,, lllleeeennnn1111,,,, vvvvaaaallll1111,,,, lllleeeennnn2222,,,, vvvvaaaallll2222,,,, ............,,,, lllleeeennnnnnnn,,,, vvvvaaaallllnnnn ))))
- iiiinnnntttteeeeggggeeeerrrr****4444 nnnnaaaarrrrggggssss,,,, lllleeeennnn1111,,,, lllleeeennnn2222,,,, ............,,,, lllleeeennnnnnnn
- aaaannnnyyyyttttyyyyppppeeee vvvvaaaallll1111,,,, vvvvaaaallll2222,,,, ............,,,, vvvvaaaallllnnnn
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- These utilities are used to provide f77 support for subroutines with
- variable number of arguments. In order to use these utilities, all
- variable argument subroutines must be declared in each source file before
- they are referenced or defined. This is done by adding a $_v_a_r_a_r_g_s
- compiler directive at the beginning of the source file.
-
- For example:
-
- $_v_a_r_a_r_g_s _v_a_s_u_b_1 _v_a_s_u_b_2 _v_a_s_u_b_3
-
- where _v_a_s_u_b_1, _v_a_s_u_b_2, and _v_a_s_u_b_3 are the names of the variable argument
- subroutines which are referenced or defined in the current source file.
-
- _a_r_g_m_n_t returns the number of actual arguments in the integer variable
- _n_a_r_g_s. The default behavior is to count each character argument in the
- actual argument list as two arguments since both the character address
- and its length will be put on the argument stack. The -_c_h_a_r_a_r_g_1 option
- can be used to count each character argument as only one argument.
-
- _g_e_t_a_d_r returns the address of the _nth argument in the variable _i_a_d_d_r.
- This function has to be used to get the length of a character argument
- since it is passed by value, not by reference like other Fortran
- arguments.
-
- _n_u_l_l_o_k returns 0 if the address of the _nth argument is the same as the
- address contained in the variable _i_a_d_d_r.
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- VVVVAAAARRRRAAAARRRRGGGGSSSS((((3333FFFF)))) VVVVAAAARRRRAAAARRRRGGGGSSSS((((3333FFFF))))
-
-
-
- _x_e_t_a_r_g initializes _l_e_n bytes of _i_a_r_g with the value of the _nth argument .
-
- _r_e_t_o_u_r returns values to the calling program by setting _n_a_r_g_s actual
- arguments using _l_e_n_1, _l_e_n_2,..., _l_e_n_n bytes of the values stored in the
- variables _v_a_l_1, _v_a_l_2,..., _v_a_l_n, respectively.
-
- In normal usage of variable argument subroutines, when the formal
- argument list is specified using the maximum number of arguments the
- subroutine can received, the argument addresses and return values are
- passed in the standard f77 convention. The only utility needed in this
- case is _a_r_g_m_n_t to determine the number of actual arguments passed to the
- variable argument subroutine.
-
- The other utilities are needed when there is no formal argument list in
- the variable argument subroutine. _x_e_t_a_r_g is normally used to initializes
- some local variables to the initial values of the actual arguments.
- _r_e_t_o_u_r is then used to return the locally calculated values back to the
- calling subroutine by setting the actual arguments to the values of the
- local variables.
-
- Example:
-
- $varargs chsign
- program tvararg
- i = 1
- j = -2
- k = 3
- call chsign( i, j, k, "fourth argument", "fifth" )
- print *, i, j, k
- end
-
- subroutine chsign()
- C This subroutine changes the sign of all integer arguments passed to it
- C and prints the value of all character arguments. It assumes that
- C there are at most three integer arguments, followed by the character
- C arguments. The way this subroutine is written it has to be compiled
- C with the -chararg1 option since it assumes that the lengths of the
- C character arguments can be obtained by using GETADR(NARGS+I) where
- C NARGS is the number of arguments returned by ARGMNT().
- integer*4 val(3)
- pointer (stradr, str)
- character*(*) str
-
- call argmnt( nargs )
- print *, "Number of arguments = ", nargs
- j = min(3,nargs)
- do 10 i=1,j
- call xetarg( i, 4, val(i) )
- 10 val(i) = - val(i)
- C Get the address and the length of the character arguments
- do 100 i=j+1, nargs
- call getadr( i, stradr )
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- VVVVAAAARRRRAAAARRRRGGGGSSSS((((3333FFFF)))) VVVVAAAARRRRAAAARRRRGGGGSSSS((((3333FFFF))))
-
-
-
- call getadr( nargs+i-j, lenstr )
- write (*,*) str(1:lenstr)
- 100 continue
-
- call retour(j,4,val(1),4,val(2),4,val(3))
- end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-